package com.example.mrzhou.lvmm.presenter.home;

import com.example.mrzhou.lvmm.entity.home.HomeBanner;
import com.example.mrzhou.lvmm.model.ModelFactory;
import com.example.mrzhou.lvmm.view.impl.home.HomeBannerView;

import rx.Subscriber;

/**
 * Created by Mr.zhou on 2016/10/28.
 */

public class HomeBannerPresenter {

    private HomeBannerView homeBannerView;

    public HomeBannerPresenter(HomeBannerView homeBannerView) {
        this.homeBannerView = homeBannerView;
    }

    public void getHomeBanner(){
        ModelFactory.getiHomeModel().getHomeBanner(new Subscriber<HomeBanner>() {
            @Override
            public void onCompleted() {
                homeBannerView.onFinsh();
            }

            @Override
            public void onError(Throwable e) {
                homeBannerView.onFaiure(e);
            }

            @Override
            public void onNext(HomeBanner homeBanner) {
                homeBannerView.onSuccess(homeBanner);
            }
        });
    }
}
